<!DOCTYPE html>
<html class="login-bg" style="background-image: url('{#:STATIC_PATH}/admin/images/8.jpg');">
<head>
    <title>{#:$system_name}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- bootstrap -->
    <link href="{#:STATIC_PATH}/admin/css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="{#:STATIC_PATH}/admin/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="{#:STATIC_PATH}/admin/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />
    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="{#:STATIC_PATH}/admin/css/layout.css" />
    <link rel="stylesheet" type="text/css" href="{#:STATIC_PATH}/admin/css/elements.css" />
    <link rel="stylesheet" type="text/css" href="{#:STATIC_PATH}/admin/css/icons.css" />
    <!-- libraries -->
    <link rel="stylesheet" type="text/css" href="{#:STATIC_PATH}/admin/css/lib/font-awesome.css" />
    <!-- this page specific styles -->
    <link rel="stylesheet" href="{#:STATIC_PATH}/admin/css/compiled/signin.css" type="text/css" media="screen" />
    <style type="text/css">
        .page_tips {
            display: none;
            min-width: 180px;
            height: 40px;
            padding-left: 10px;
            padding-right: 10px;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            text-align: center;
            z-index: 599
        }
        .page_tips .inner {
            padding: 0 30px;
            display: inline-block;
            font-size: 14px;
            border-radius: 0 0 4px 4px;
            color: #fff;
            height: 36px;
            line-height: 36px
        }
        .page_tips.success .inner {
            background: #4a90e2
        }
        .page_tips.error .inner {
            background: #ee8756
        }
    </style>
<body>
    <div id="js_tips" class="page_tips " style="display: none;"><div class="inner"></div></div>
    <div class="row-fluid login-wrapper">
        <a href="javascript:;">
            <!-- <img class="logo" src="{#:STATIC_PATH}/admin/images/logo-white.png" /> -->
        </a>
        <div class="span4 box">
            <div class="content-wrap">
                <h6>云天下管理中心</h6>
                <input id="username" class="span12" type="text" placeholder="请输入您的帐号" value="{#:$username|default:''}" />
                <input id="password" class="span12" type="password" placeholder="请输入您的密码" value="{#:$password|default:''}" />
                <div class="remember">
                    <input id="remember-me" type="checkbox"/>
                    <label for="remember-me">记住我</label>
                </div>
                <a id="submit" class="btn-glow primary login" href="javascript:;">登 录</a>
            </div>
        </div>
        <div class="span4 no-account">
            <p>
                {#:$copyright_info}
                <br/>
                <a href="{#:$company_url}" target="_blank">{#:$company_name}</a>
            </p>
        </div>
    </div>
<!-- scripts -->
<script src="{#:STATIC_PATH}/admin/js/jquery-1.11.2.min.js"></script>
<script src="{#:STATIC_PATH}/admin/js/bootstrap.min.js"></script>
<script src="{#:STATIC_PATH}/admin/js/theme.js"></script>
<script src="{#:STATIC_PATH}/vendor/layer/layer.js"></script>
<script type="text/javascript">
$(function() {

    var remember = "{#:$remember|default:''}";
    if(remember == 1) {
        $("#remember-me").attr('checked', 'true');
    }

    // 回车事件
    document.onkeydown = function(event){
        e = event ? event :(window.event ? window.event : null);
        if(e.keyCode == 13){
            $('#submit').click();
        }
    }

    // 点击登录
    $('#submit').click(function(){
        if($('#remember-me').is(":checked")) {
            var remember = 1;
        } else {
            var remember = 0;
        }
        var username = $.trim($('#username').val());
        var password = $.trim($('#password').val());
        if(username == '') {
            msg('请输入登录账号');
            $('#username').focus();
        } else if(password == '') {
            msg('请输入登录密码');
            $('#password').focus();
        } else {
            $.post("{#:url('login/verify')}",{username:username, password:password, remember:remember},function(response){
                // console.log(response);return false;
                if(response.status == 1) {
                    location.href = response.url;
                } else {
                    msg(response.info);
                }
            },'json');
        }
    });

});

/**
 * 消息提示
 * @param  {[type]}   msn [消息内容]
 * @param  {[type]}   err [1成功 0失败]
 * @return {[type]}       [description]
 */
function msg(msn, err)
{
    // 清除之前的信息
    $("#js_tips .inner").html('');
    $("#js_tips").removeClass('success');
    $("#js_tips").removeClass('error');

    // 判断新的消息
    var e = err || 0;
    if(e == 1) {
        $("#js_tips").addClass('success');
    } else {
        $("#js_tips").addClass('error');
    }
    $("#js_tips .inner").html(msn);
    $("#js_tips").show();

    setTimeout(function(){
        $("#js_tips").hide();
    }, 3000);
}

</script>
</body>
</html>